import { useSelector, useDispatch } from 'react-redux';

import { increment } from './store/actions/counter';

export const Child1 = () => {
  const state = useSelector((state) => state.counter);

  // 获取分发action的dispatch
  const dispatch = useDispatch();

  return (
    <div>
      Child1获取到redux中的数据{state}{' '}
      <button onClick={() => dispatch(increment(6))}>++</button>
    </div>
  );
};
